
import React from 'react';

class SvgIcon extends React.Component {
    render() {
        const { sprite, symbol, className } = this.props;

        return (
            <svg
                className={className}
                aria-hidden>
                <use xlinkHref={this.getHref()} />
            </svg>
        );
    }
    getHref() {
        if (!(this.props.sprite && this.props.symbol)) {
            return;
        }

        const { sprite, symbol } = this.props;
        const href = `/dist/assets/icons/${sprite}/svg/symbols.svg#${symbol}`;
        return href;
    }
}

// SvgIcon.propTypes = {
//     className: React.PropTypes.string,
//     sprite: React.PropTypes.string,
//     symbol: React.PropTypes.string
// };

export default SvgIcon;